﻿namespace Mp3Observer.Common.IoC
{
    using System.Configuration;

    /// <summary>
    /// ConfigurationElement for standard Components
    /// </summary>
    /// <example>
    /// <![CDATA[ 
    ///   <Components resolver="Mp3Observer.Common.IoC.DependencyResolver, Mp3Observer.Common">
    ///     <add name="IFileSearch" contract="Mp3Observer.Interfaces.IFileSearch,  Mp3Observer.Interfaces" implementation="Mp3Observer.Services.FileSearch,  Mp3Observer.Services" />
    /// ]]>
    /// </example>
    public class ComponentElement : ConfigurationElement
    {
        /// <summary>
        /// Gets or sets the name.
        /// </summary>
        /// <value>The name.</value>
        [ConfigurationProperty("name", DefaultValue = "", IsKey = true, IsRequired = true)]
        public string Name
        {
            get { return (string)base["name"]; }
            set { base["name"] = value; }
        }

        /// <summary>
        /// Gets or sets the contract.
        /// </summary>
        /// <value>The contract.</value>
        [ConfigurationProperty("contract", DefaultValue = "", IsKey = false, IsRequired = true)]
        public string Contract
        {
            get { return (string)base["contract"]; }
            set { base["contract"] = value; }
        }

        /// <summary>
        /// Gets or sets the implementation.
        /// </summary>
        /// <value>The implementation.</value>
        [ConfigurationProperty("implementation", DefaultValue = "", IsKey = false, IsRequired = false)]
        public string Implementation
        {
            get { return (string)base["implementation"]; }
            set { base["implementation"] = value; }
        }

        /// <summary>
        /// Gets the ConstructorCollection.
        /// </summary>
        /// <value>The ConstructorCollection.</value>
        [ConfigurationProperty("constructor")]
        public ConstructorCollection Constructors
        {
            get { return (ConstructorCollection)base["constructor"]; }
        }
    }
}
